package spring.boot.demo.task;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledTasks {
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
	
	@Scheduled(fixedRate=5000)
	public void reportCurrenntTime(){
		System.out.println(dateFormat.get2DigitYearStart());
		System.out.println("当前时间"+dateFormat.format(new Date()));
		dateFormat.set2DigitYearStart(new Date());
		System.out.println(dateFormat.get2DigitYearStart());
	}
}
